@extends('layouts.app')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <div class="">
                <form method="get" class="form form-inline" action="{{ route('admin.rechargeRecord.index') }}"  autocomplete="off">
                    <div class="form-group ">
                        <input  style="min-width:250px; max-width:300px;" class="form-control" type="text" name="order_id" value="{{$orderId}}" placeholder="订单ID">
                    </div>
                    <div class="form-group ">
                        <input  style="min-width:250px; max-width:300px;" class="form-control" type="text" name="name" value="{{$name}}" placeholder="姓名/昵称/电话">
                    </div>
                    <div class="form-group " >
                        <div class="form-group form-inline">
                            <input  style="min-width:250px; max-width:300px;" class="form-control" type="text" placeholder="起始时间" id="start" name="start"
                                   value="{{$start}}"/>
                            -
                            <input  style="min-width:250px; max-width:300px;" class="form-control" type="text" placeholder="截止时间" id="end" name="end"
                                   value="{{$end}}"/>
                        </div>
                    </div>
                    <div class="form-group ">
                        <button class="btn btn-success btn-ms" type="submit">搜索</button>
                    </div>
                </form>
            </div>

            <br/>
            <div class="form-inline">
                <div class="form-group" style="font-weight: bold;margin-right: 30px;">记录条数: {{$count}}</div>
                <div class="form-group" style="font-weight: bold;margin-right: 30px;">充值金额: {{$cz_money}}</div>
                <div class="form-group" style="font-weight: bold;margin-right: 30px;">赠送金额: {{$zs_money}}</div>
                <!-- <div class="form-group" style="font-weight: bold;margin-right: 30px;">充值余额总额: {{$zs_money}}</div> -->
            </div>
            <hr/>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th style="min-width:100px">ID</th>
                    <th style="min-width:100px">订单ID</th>
                    <th style="min-width:100px">用户</th>
                    <th style="min-width:100px">所属商户</th>
                    <th style="min-width:100px">充值金额</th>
                    <th style="min-width:100px">赠送金额</th>
                    <th style="min-width:100px">本次合计</th>
                    <th style="min-width:100px">来源</th>
                    <!-- <th style="min-width:100px">订单状态</th> -->
                    <th style="min-width:100px">时间</th>
                    <th style="min-width:100px">当前门店余额</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr>
                        <td>{{ $item->id }}</td>
                        <td>
                            @if(!empty($item->order_id))
                                {{ $item->order_id }}
                            @endif
                        </td>
                        <td><img src="{{  $item->avatar }}" width="30">{{ $item->nickname }}</td>
                        <td>{!! $item->shop_name !!}</td>
                        
                        <td>{{ $item->cz_money }}</td>
                        <td>{!! $item->zs_money !!}</td>
                        <td>{!! $item->total !!}</td>
                        <td>{!! $item->recharge_mode !!}</td>
                        <!-- <td>{!! $item->status !!}</td> -->
                        <td>{!! $item->created_at !!}</td>
                        <td>
                            @if(empty($aUserBalance[$item->user_id.'_'.$item->shop_id]))
                                0
                            @else
                                {{ $aUserBalance[$item->user_id.'_'.$item->shop_id]->balance }}
                            @endif
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            {{ $data->appends(request()->all())->links() }}
        </div>
    </div>

@endsection
@push('scripts')
<script>
    $('#start').datetimepicker({format: "Y-m-d",timepicker:false});
    $('#end').datetimepicker({format: "Y-m-d",timepicker:false});
    // $('#start').attr('readonly', 'readonly');
    // $('#end').attr('readonly', 'readonly');
    $.datetimepicker.setLocale('zh');
</script>
@endpush
